package com.shop.admin.controller;

import com.shop.Result.LdbzResult;
import com.shop.admin.service.AdminIndexRecommmendAdService;
import com.shop.pojo.LdbzIndexRecommendAd;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/indexR/Service")
public class AdminIndexRecommendAdController {

    private static final Logger logger = LoggerFactory.getLogger(AdminIndexRecommendAdController.class);

    @Autowired
    private AdminIndexRecommmendAdService adminIndexRecommmendAdService;

    @RequestMapping(value="/editIndexRecommendAd/{id}" , method = RequestMethod.GET)
    public LdbzResult editIndexRecommendAd(@PathVariable("id")long id , Model model) {
        return adminIndexRecommmendAdService.selectByKey(id);
    }

    @RequestMapping(value="/getIndexRecommendAdPage" , method = RequestMethod.GET)
    public LdbzResult getIndexRecommendAdPage(LdbzIndexRecommendAd entity , int page , int limit) {
        return adminIndexRecommmendAdService.getIndexRecommendAdPage(entity, page, limit);
    }

    @RequestMapping(value="/selectByKey/{id}" , method = RequestMethod.GET)
    public LdbzResult selectByKey(@PathVariable("id")long id) {
        return adminIndexRecommmendAdService.selectByKey(id);
    }

    @RequestMapping(value="/updateByKey" , method = RequestMethod.GET)
    public LdbzResult updateByKey(LdbzIndexRecommendAd entity) {
        return adminIndexRecommmendAdService.updateByKey(entity);
    }
}
